﻿<Window x:Class="RL.wFuelType"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Вид ГСМ" Height="320" Width="434" Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <CollectionViewSource x:Key="sourceFuelType" />
        <DataTemplate x:Key="cellDel">
            <CheckBox IsEnabled="False" IsChecked="{Binding Path=del}" />
        </DataTemplate>
        <DataTemplate x:Key="cellId">
            <TextBox Text="{Binding Path=id}" IsReadOnly="True" />
        </DataTemplate>
        <DataTemplate x:Key="cellName">
            <TextBox Text="{Binding Path=name}" />
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="36" />
            <RowDefinition Height="*" />
            <RowDefinition Height="36" />
        </Grid.RowDefinitions>
        <StackPanel Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Добавить" Height="23" Name="buttonAdd" Width="75" Click="buttonAdd_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDelete" Width="75" Click="buttonDelete_Click" />
            <Button Content="Сохранить" Height="23" Name="buttonSave" Width="95" Click="buttonSave_Click" />
            <!-- <Button Content="Редактировать" Height="23" Name="buttonEdit" Width="95" Click="buttonEdit_Click" /> -->
        </StackPanel>
        <StackPanel Name="stackPanel2" Orientation="Horizontal" Grid.Row="2">
            <Button Content="OK" Height="23" Name="buttonOK" Width="75" Click="buttonOK_Click" />
        </StackPanel>
        <ListView Grid.Row="1" Name="listView1" ItemsSource="{Binding Source={StaticResource sourceFuelType}}" SelectionMode="Single">
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                    <EventSetter Event="PreviewGotKeyboardFocus" Handler="SelectCurrentItem"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>
                    <!-- <GridViewColumn Header="Выкл." Width="35" CellTemplate="{StaticResource cellDel}"/>-->
                    <GridViewColumn Header="Код" Width="50" CellTemplate="{StaticResource cellId}"/>
                    <GridViewColumn Header="ГСМ" Width="200" CellTemplate="{StaticResource cellName}"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</Window>
